If we're not daemonizing, this is a useful way to ensure we go away if
our parent does.
https://bugzilla.gnome.org/show_bug.cgi?id=741264
#include "otutil.h"
#include <sys/socket.h>
+#include <sys/prctl.h>
+#include <signal.h>
static char *opt_port_file = NULL;
static gboolean opt_daemonize;
#if !SOUP_CHECK_VERSION(2, 48, 0)
soup_server_run_async (server);
#endif
-
+
if (opt_daemonize)
{
pid_t pid = fork();
fclose (stdout);
fclose (stdin);
}
+ else
+ {
+ /* Since we're used for testing purposes, let's just do this by
+ * default. This ensures we exit when our parent does.
+ */
+ if (prctl (PR_SET_PDEATHSIG, SIGTERM) != 0)
+ {
+ int errsv = errno;
+ if (errsv != ENOSYS)
+ {
+ ot_util_set_error_from_errno (error, errsv);
+ goto out;
+ }
+ }
+ }
app->running = TRUE;
if (opt_autoexit)